//
//  PtlistModel.swift
//
//  Created by eme on 2017/1/3
//  Copyright (c) . All rights reserved.
//

import Foundation
import SwiftyJSON
import ModelProtocol

class PtlistModel: ModelProtocol ,Copyable{
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    internal let kPtlistPtnameKey: String = "ptname"
    internal let kPtlistPtidKey: String = "ptid"
    
    
    // MARK: 属性
    var ptname: String
    var ptid: Int
    
    
    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
    required  init?(json: JSON) {
        ptname = json[kPtlistPtnameKey].stringValue
        ptid = json[kPtlistPtidKey].intValue
        
    }
    func copy() -> Copyable {
        let pt = PtlistModel(json: "")
        pt?.ptid = self.ptid
        pt?.ptname = self.ptname
        return pt!
    }
    
    /**
     Generates description of the object in the form of a NSDictionary.
     - returns: A Key value pair containing all valid values in the object.
     */
    internal func dictionaryRepresentation() -> [String : AnyObject ] {
        
        var dictionary: [String : AnyObject ] = [ : ]
        
        dictionary.updateValue(ptname as AnyObject, forKey: kPtlistPtnameKey)
        
        dictionary.updateValue(ptid as AnyObject, forKey: kPtlistPtidKey)
        
        
        return dictionary
    }
    
    
}
